import { Navigate, Outlet } from 'react-router-dom';
import { useAppSelector } from '../store/hook';

// 用于鉴权
export const Auth = () => {
  const token = useAppSelector((state) => state.user.token);
  if (!token) {
    return <Navigate to='/login' replace />;
  }

  return <Outlet />;
};
